package com.sushi.controller;

import com.sushi.service.OrderService;
import com.sushi.response.ResponseBO;
import com.sushi.response.ResponsePageBO;
import com.sushi.response.OrderResp;
import com.sushi.request.OrderReq;
import com.sushi.request.OrderPageReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.*;

/**
 * 订单 控制器
 * @date 2023-05-02
 * @time 17:15:28
 * @author Administrator
 */
@RestController
@Slf4j
public class OrderController {

	@Autowired
	private OrderService orderService;

    

    /**
     * 新增
     */
    @PostMapping("/order/add")
    public ResponseBO<OrderResp> add(@RequestBody OrderReq req) {
        return orderService.add(req);
    }

    /**
     * 逻辑删除
     */
    @PostMapping("/order/remove")
    public ResponseBO<OrderResp> remove(@RequestBody OrderReq req) {
        return orderService.logicRemove(req);
    }

    /**
     * 更新
     */
    @PostMapping("/order/update")
    public ResponseBO<OrderResp> update(@RequestBody OrderReq req) {
        return orderService.updateByField(req);
    }

    /**
     * 列表
     */
    @PostMapping("/order/list")
    public ResponsePageBO<OrderResp> list(@RequestBody OrderPageReq req) {
        return orderService.listByCondition(req);
    }

    /**
     * 详情
     */
    @PostMapping("/order/detail")
    public ResponseBO<OrderResp> detail(@RequestBody OrderReq req) {
        return orderService.detail(req);
    };

}